﻿using <%=model_namespace%>;
using System;
using System.Collections.Generic;
using System.Text;

namespace <%=namespace%>
{
    public interface <%=class_name%>
    {
        #region 查询
        /// <summary>
        /// 根据键值查询单个信息
        /// </summary>
        /// <param name="<%=key%>">键值</param>
        /// <returns></returns>
        <%=model_name%> Get(<%=datatype.parse(key_type)%> <%=key%>);

        /// <summary>
        /// 分页查询批量信息
        /// </summary>
        <%for(var i = 0; i < fields.length; i++) {%>/// <param name="<%=fields[i].column_name%>"><%=fields[i].column_comment%></param>
        <%}%>/// <param name="page">页码</param>
        /// <param name="page_size">每页显示的条数</param>
        /// <returns></returns>
        Tuple<List<<%=model_name%>>, int> ListPagin(<%for(var i = 0; i < fields.length; i++) {%><%=datatype.parse(fields[i].data_type)%> <%=fields[i].column_name%>, <%}%>int page, int page_size);

        /// <summary>
        /// 查询批量信息
        /// </summary>
        <%for(var i = 0; i < fields.length; i++) {%>/// <param name="<%=fields[i].column_name%>"><%=fields[i].column_comment%></param>
        <%}%>/// <returns></returns>
        List<<%=model_name%>> List(<%for(var i = 0; i < fields.length; i++) {%><%if(i>0){%>, <%}%><%=datatype.parse(fields[i].data_type)%> <%=fields[i].column_name%><%}%>);
        #endregion

        #region 提交
        /// <summary>
        /// 添加当前列表数据
        /// </summary>
        /// <param name="model">实体</param>
        /// <returns></returns>
        bool Insert(<%=model_name%> model);

        /// <summary>
        /// 更新当前列表数据
        /// </summary>
        /// <param name="model">实体</param>
        /// <returns></returns>
        bool Update(<%=model_name%> model);

        /// <summary>
        ///  删除当前列表数据
        /// </summary>
        /// <param name="<%=key%>_arr">键值</param>
        /// <returns></returns>
        bool Delete(params <%=datatype.parse(key_type)%>[] <%=key%>_arr);

        /// <summary>
        /// 获得要导出的数据的Excel字节
        /// </summary>
        <%for(var i = 0; i < fields.length; i++) {%>/// <param name="<%=fields[i].column_name%>"><%=fields[i].column_comment%></param>
        <%}%>/// <returns></returns>
        byte[] Export(<%for(var i = 0; i < fields.length; i++) {%><%if(i>0){%>, <%}%><%=datatype.parse(fields[i].data_type)%> <%=fields[i].column_name%><%}%>);
        #endregion
    }
}
